export function uploadImage(url: string, title: string, err_title: string) {

    return new Promise((resolve, reject) => {
        uni.chooseImage({
            count: 6, //默认9
            sizeType: ['compressed'], //压缩图
            sourceType: ['album', 'camera '], //从相册选择或者拍照
            success: function (res) {
                uni.showLoading({ title, mask: true });
                const imguRL = res.tempFilePaths[0];
                uni.uploadFile({
                    url, //仅为示例，非真实的接口地址
                    filePath: imguRL,
                    name: 'file',
                    success: (uploadFileRes) => {
                        uni.hideLoading();
                        resolve(uploadFileRes)
                    }
                });
            },
            fail: (err) => {
                uni.showToast({
                    title: err_title,
                    duration: 1000
                })
                reject(err)
            }
        })
    })

}
